//
//  HunterCollectionViewCell.m
//  littleLight's Project-A
//
//  Created by dllo on 16/5/25.
//  Copyright © 2016年 light. All rights reserved.
//

#import "HunterCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation HunterCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView
{
    self.avatarImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 60, 60)];
    self.avatarImageView.layer.masksToBounds = YES;
    self.avatarImageView.layer.cornerRadius = 30;
    [self.contentView addSubview:self.avatarImageView];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 10, 280, 30)];
    self.nameLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.nameLabel];
    
    self.productLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 40, 250, 30)];
    self.productLabel.font = [UIFont systemFontOfSize:14];
    self.productLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.productLabel];
    
    
    self.commentLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 80, self.contentView.frame.size.width - 15, 70)];
    self.commentLabel.numberOfLines = 0;
    self.commentLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.commentLabel];
    
   
    
    
}

- (void)setModel:(Hunter_listModel *)model
{
    _model = model;
    
    if ([[_model.goodcomment_rate stringValue]isEqualToString:@"5"]) {
       
        for (int i = 0; i < 5; i++) {
            UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(10 + (i * 10) + (i * 5), 160, 10, 10)];
           // imageV.backgroundColor = [UIColor yellowColor];
            imageV.image = [UIImage imageNamed:@"tripLikeStar"];
            [self.contentView addSubview:imageV];
        }
    }
    
    [self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:_model.avatar_m]];
    self.nameLabel.text = _model.name;
    self.commentLabel.text = _model.comment_text;
    self.productLabel.text = _model.product_title;
    
    
    
    
    
}

@end
